/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package byzantine.controls;

import byzantine.ByzantineModel;
import byzantine.controls.listeners.ExitListener;
import byzantine.views.View;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/**
 *
 * @author rpathan
 */
public class MenuControls implements View {

    private ByzantineModel model;

    private JMenuBar menu;

    private JMenu file;

    private JMenuItem exit;

    public MenuControls(ByzantineModel model) {
        this.model = model;
        model.addObserver(this);
        initializeMenu();
    }

    private void initializeMenu() {
        menu = new JMenuBar();

        file = new JMenu("File");
        file.setMnemonic(KeyEvent.VK_F);

        exit = new JMenuItem("Exit", KeyEvent.VK_X);
        exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
        exit.addActionListener(new ExitListener());
        file.add(exit);

        menu.add(file);
    }

    public JMenuBar getMenuBar() {
        return menu;
    }

    public void valueChanged() {
        
    }

}
